#include "live.h"

namespace {
#define DIM 22
#define EDIM 21
#define MEDIM 21
typedef void (*Hfun)(double *, double *, double *);
const static double MAHA_THRESH_4 = 7.814727903251177;
const static double MAHA_THRESH_9 = 7.814727903251177;
const static double MAHA_THRESH_10 = 7.814727903251177;
const static double MAHA_THRESH_12 = 7.814727903251177;
const static double MAHA_THRESH_35 = 7.814727903251177;
const static double MAHA_THRESH_32 = 9.487729036781154;
const static double MAHA_THRESH_13 = 7.814727903251177;
const static double MAHA_THRESH_14 = 7.814727903251177;
const static double MAHA_THRESH_33 = 7.814727903251177;

/******************************************************************************
 *                       Code generated with SymPy 1.12                       *
 *                                                                            *
 *              See http://www.sympy.org/ for more information.               *
 *                                                                            *
 *                         This file is part of 'ekf'                         *
 ******************************************************************************/
void H(double *in_vec, double *out_925951862747328981) {
   out_925951862747328981[0] = 0;
   out_925951862747328981[1] = -sin(in_vec[1])*sin(in_vec[2])*in_vec[4] - sin(in_vec[1])*cos(in_vec[2])*in_vec[3] - cos(in_vec[1])*in_vec[5];
   out_925951862747328981[2] = -sin(in_vec[2])*cos(in_vec[1])*in_vec[3] + cos(in_vec[1])*cos(in_vec[2])*in_vec[4];
   out_925951862747328981[3] = cos(in_vec[1])*cos(in_vec[2]);
   out_925951862747328981[4] = sin(in_vec[2])*cos(in_vec[1]);
   out_925951862747328981[5] = -sin(in_vec[1]);
   out_925951862747328981[6] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (-sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*in_vec[5];
   out_925951862747328981[7] = -sin(in_vec[0])*sin(in_vec[1])*in_vec[5] + sin(in_vec[0])*sin(in_vec[2])*cos(in_vec[1])*in_vec[4] + sin(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3];
   out_925951862747328981[8] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[3] + (sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]))*in_vec[4];
   out_925951862747328981[9] = sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) - sin(in_vec[2])*cos(in_vec[0]);
   out_925951862747328981[10] = sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) + cos(in_vec[0])*cos(in_vec[2]);
   out_925951862747328981[11] = sin(in_vec[0])*cos(in_vec[1]);
   out_925951862747328981[12] = (-sin(in_vec[0])*sin(in_vec[1])*sin(in_vec[2]) - cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (-sin(in_vec[0])*sin(in_vec[1])*cos(in_vec[2]) + sin(in_vec[2])*cos(in_vec[0]))*in_vec[3] - sin(in_vec[0])*cos(in_vec[1])*in_vec[5];
   out_925951862747328981[13] = -sin(in_vec[1])*cos(in_vec[0])*in_vec[5] + sin(in_vec[2])*cos(in_vec[0])*cos(in_vec[1])*in_vec[4] + cos(in_vec[0])*cos(in_vec[1])*cos(in_vec[2])*in_vec[3];
   out_925951862747328981[14] = (sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]))*in_vec[4] + (sin(in_vec[0])*cos(in_vec[2]) - sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]))*in_vec[3];
   out_925951862747328981[15] = sin(in_vec[0])*sin(in_vec[2]) + sin(in_vec[1])*cos(in_vec[0])*cos(in_vec[2]);
   out_925951862747328981[16] = -sin(in_vec[0])*cos(in_vec[2]) + sin(in_vec[1])*sin(in_vec[2])*cos(in_vec[0]);
   out_925951862747328981[17] = cos(in_vec[0])*cos(in_vec[1]);
}
void err_fun(double *nom_x, double *delta_x, double *out_2728202755002846775) {
   out_2728202755002846775[0] = delta_x[0] + nom_x[0];
   out_2728202755002846775[1] = delta_x[1] + nom_x[1];
   out_2728202755002846775[2] = delta_x[2] + nom_x[2];
   out_2728202755002846775[3] = -0.5*delta_x[3]*nom_x[4] - 0.5*delta_x[4]*nom_x[5] - 0.5*delta_x[5]*nom_x[6] + 1.0*nom_x[3];
   out_2728202755002846775[4] = 0.5*delta_x[3]*nom_x[3] + 0.5*delta_x[4]*nom_x[6] - 0.5*delta_x[5]*nom_x[5] + 1.0*nom_x[4];
   out_2728202755002846775[5] = -0.5*delta_x[3]*nom_x[6] + 0.5*delta_x[4]*nom_x[3] + 0.5*delta_x[5]*nom_x[4] + 1.0*nom_x[5];
   out_2728202755002846775[6] = 0.5*delta_x[3]*nom_x[5] - 0.5*delta_x[4]*nom_x[4] + 0.5*delta_x[5]*nom_x[3] + 1.0*nom_x[6];
   out_2728202755002846775[7] = delta_x[6] + nom_x[7];
   out_2728202755002846775[8] = delta_x[7] + nom_x[8];
   out_2728202755002846775[9] = delta_x[8] + nom_x[9];
   out_2728202755002846775[10] = delta_x[9] + nom_x[10];
   out_2728202755002846775[11] = delta_x[10] + nom_x[11];
   out_2728202755002846775[12] = delta_x[11] + nom_x[12];
   out_2728202755002846775[13] = delta_x[12] + nom_x[13];
   out_2728202755002846775[14] = delta_x[13] + nom_x[14];
   out_2728202755002846775[15] = delta_x[14] + nom_x[15];
   out_2728202755002846775[16] = delta_x[15] + nom_x[16];
   out_2728202755002846775[17] = delta_x[16] + nom_x[17];
   out_2728202755002846775[18] = delta_x[17] + nom_x[18];
   out_2728202755002846775[19] = delta_x[18] + nom_x[19];
   out_2728202755002846775[20] = delta_x[19] + nom_x[20];
   out_2728202755002846775[21] = delta_x[20] + nom_x[21];
}
void inv_err_fun(double *nom_x, double *true_x, double *out_6450214050690645905) {
   out_6450214050690645905[0] = -nom_x[0] + true_x[0];
   out_6450214050690645905[1] = -nom_x[1] + true_x[1];
   out_6450214050690645905[2] = -nom_x[2] + true_x[2];
   out_6450214050690645905[3] = 2*nom_x[3]*true_x[4] - 2*nom_x[4]*true_x[3] + 2*nom_x[5]*true_x[6] - 2*nom_x[6]*true_x[5];
   out_6450214050690645905[4] = 2*nom_x[3]*true_x[5] - 2*nom_x[4]*true_x[6] - 2*nom_x[5]*true_x[3] + 2*nom_x[6]*true_x[4];
   out_6450214050690645905[5] = 2*nom_x[3]*true_x[6] + 2*nom_x[4]*true_x[5] - 2*nom_x[5]*true_x[4] - 2*nom_x[6]*true_x[3];
   out_6450214050690645905[6] = -nom_x[7] + true_x[7];
   out_6450214050690645905[7] = -nom_x[8] + true_x[8];
   out_6450214050690645905[8] = -nom_x[9] + true_x[9];
   out_6450214050690645905[9] = -nom_x[10] + true_x[10];
   out_6450214050690645905[10] = -nom_x[11] + true_x[11];
   out_6450214050690645905[11] = -nom_x[12] + true_x[12];
   out_6450214050690645905[12] = -nom_x[13] + true_x[13];
   out_6450214050690645905[13] = -nom_x[14] + true_x[14];
   out_6450214050690645905[14] = -nom_x[15] + true_x[15];
   out_6450214050690645905[15] = -nom_x[16] + true_x[16];
   out_6450214050690645905[16] = -nom_x[17] + true_x[17];
   out_6450214050690645905[17] = -nom_x[18] + true_x[18];
   out_6450214050690645905[18] = -nom_x[19] + true_x[19];
   out_6450214050690645905[19] = -nom_x[20] + true_x[20];
   out_6450214050690645905[20] = -nom_x[21] + true_x[21];
}
void H_mod_fun(double *state, double *out_2701558932546138787) {
   out_2701558932546138787[0] = 1.0;
   out_2701558932546138787[1] = 0;
   out_2701558932546138787[2] = 0;
   out_2701558932546138787[3] = 0;
   out_2701558932546138787[4] = 0;
   out_2701558932546138787[5] = 0;
   out_2701558932546138787[6] = 0;
   out_2701558932546138787[7] = 0;
   out_2701558932546138787[8] = 0;
   out_2701558932546138787[9] = 0;
   out_2701558932546138787[10] = 0;
   out_2701558932546138787[11] = 0;
   out_2701558932546138787[12] = 0;
   out_2701558932546138787[13] = 0;
   out_2701558932546138787[14] = 0;
   out_2701558932546138787[15] = 0;
   out_2701558932546138787[16] = 0;
   out_2701558932546138787[17] = 0;
   out_2701558932546138787[18] = 0;
   out_2701558932546138787[19] = 0;
   out_2701558932546138787[20] = 0;
   out_2701558932546138787[21] = 0;
   out_2701558932546138787[22] = 1.0;
   out_2701558932546138787[23] = 0;
   out_2701558932546138787[24] = 0;
   out_2701558932546138787[25] = 0;
   out_2701558932546138787[26] = 0;
   out_2701558932546138787[27] = 0;
   out_2701558932546138787[28] = 0;
   out_2701558932546138787[29] = 0;
   out_2701558932546138787[30] = 0;
   out_2701558932546138787[31] = 0;
   out_2701558932546138787[32] = 0;
   out_2701558932546138787[33] = 0;
   out_2701558932546138787[34] = 0;
   out_2701558932546138787[35] = 0;
   out_2701558932546138787[36] = 0;
   out_2701558932546138787[37] = 0;
   out_2701558932546138787[38] = 0;
   out_2701558932546138787[39] = 0;
   out_2701558932546138787[40] = 0;
   out_2701558932546138787[41] = 0;
   out_2701558932546138787[42] = 0;
   out_2701558932546138787[43] = 0;
   out_2701558932546138787[44] = 1.0;
   out_2701558932546138787[45] = 0;
   out_2701558932546138787[46] = 0;
   out_2701558932546138787[47] = 0;
   out_2701558932546138787[48] = 0;
   out_2701558932546138787[49] = 0;
   out_2701558932546138787[50] = 0;
   out_2701558932546138787[51] = 0;
   out_2701558932546138787[52] = 0;
   out_2701558932546138787[53] = 0;
   out_2701558932546138787[54] = 0;
   out_2701558932546138787[55] = 0;
   out_2701558932546138787[56] = 0;
   out_2701558932546138787[57] = 0;
   out_2701558932546138787[58] = 0;
   out_2701558932546138787[59] = 0;
   out_2701558932546138787[60] = 0;
   out_2701558932546138787[61] = 0;
   out_2701558932546138787[62] = 0;
   out_2701558932546138787[63] = 0;
   out_2701558932546138787[64] = 0;
   out_2701558932546138787[65] = 0;
   out_2701558932546138787[66] = -0.5*state[4];
   out_2701558932546138787[67] = -0.5*state[5];
   out_2701558932546138787[68] = -0.5*state[6];
   out_2701558932546138787[69] = 0;
   out_2701558932546138787[70] = 0;
   out_2701558932546138787[71] = 0;
   out_2701558932546138787[72] = 0;
   out_2701558932546138787[73] = 0;
   out_2701558932546138787[74] = 0;
   out_2701558932546138787[75] = 0;
   out_2701558932546138787[76] = 0;
   out_2701558932546138787[77] = 0;
   out_2701558932546138787[78] = 0;
   out_2701558932546138787[79] = 0;
   out_2701558932546138787[80] = 0;
   out_2701558932546138787[81] = 0;
   out_2701558932546138787[82] = 0;
   out_2701558932546138787[83] = 0;
   out_2701558932546138787[84] = 0;
   out_2701558932546138787[85] = 0;
   out_2701558932546138787[86] = 0;
   out_2701558932546138787[87] = 0.5*state[3];
   out_2701558932546138787[88] = 0.5*state[6];
   out_2701558932546138787[89] = -0.5*state[5];
   out_2701558932546138787[90] = 0;
   out_2701558932546138787[91] = 0;
   out_2701558932546138787[92] = 0;
   out_2701558932546138787[93] = 0;
   out_2701558932546138787[94] = 0;
   out_2701558932546138787[95] = 0;
   out_2701558932546138787[96] = 0;
   out_2701558932546138787[97] = 0;
   out_2701558932546138787[98] = 0;
   out_2701558932546138787[99] = 0;
   out_2701558932546138787[100] = 0;
   out_2701558932546138787[101] = 0;
   out_2701558932546138787[102] = 0;
   out_2701558932546138787[103] = 0;
   out_2701558932546138787[104] = 0;
   out_2701558932546138787[105] = 0;
   out_2701558932546138787[106] = 0;
   out_2701558932546138787[107] = 0;
   out_2701558932546138787[108] = -0.5*state[6];
   out_2701558932546138787[109] = 0.5*state[3];
   out_2701558932546138787[110] = 0.5*state[4];
   out_2701558932546138787[111] = 0;
   out_2701558932546138787[112] = 0;
   out_2701558932546138787[113] = 0;
   out_2701558932546138787[114] = 0;
   out_2701558932546138787[115] = 0;
   out_2701558932546138787[116] = 0;
   out_2701558932546138787[117] = 0;
   out_2701558932546138787[118] = 0;
   out_2701558932546138787[119] = 0;
   out_2701558932546138787[120] = 0;
   out_2701558932546138787[121] = 0;
   out_2701558932546138787[122] = 0;
   out_2701558932546138787[123] = 0;
   out_2701558932546138787[124] = 0;
   out_2701558932546138787[125] = 0;
   out_2701558932546138787[126] = 0;
   out_2701558932546138787[127] = 0;
   out_2701558932546138787[128] = 0;
   out_2701558932546138787[129] = 0.5*state[5];
   out_2701558932546138787[130] = -0.5*state[4];
   out_2701558932546138787[131] = 0.5*state[3];
   out_2701558932546138787[132] = 0;
   out_2701558932546138787[133] = 0;
   out_2701558932546138787[134] = 0;
   out_2701558932546138787[135] = 0;
   out_2701558932546138787[136] = 0;
   out_2701558932546138787[137] = 0;
   out_2701558932546138787[138] = 0;
   out_2701558932546138787[139] = 0;
   out_2701558932546138787[140] = 0;
   out_2701558932546138787[141] = 0;
   out_2701558932546138787[142] = 0;
   out_2701558932546138787[143] = 0;
   out_2701558932546138787[144] = 0;
   out_2701558932546138787[145] = 0;
   out_2701558932546138787[146] = 0;
   out_2701558932546138787[147] = 0;
   out_2701558932546138787[148] = 0;
   out_2701558932546138787[149] = 0;
   out_2701558932546138787[150] = 0;
   out_2701558932546138787[151] = 0;
   out_2701558932546138787[152] = 0;
   out_2701558932546138787[153] = 1.0;
   out_2701558932546138787[154] = 0;
   out_2701558932546138787[155] = 0;
   out_2701558932546138787[156] = 0;
   out_2701558932546138787[157] = 0;
   out_2701558932546138787[158] = 0;
   out_2701558932546138787[159] = 0;
   out_2701558932546138787[160] = 0;
   out_2701558932546138787[161] = 0;
   out_2701558932546138787[162] = 0;
   out_2701558932546138787[163] = 0;
   out_2701558932546138787[164] = 0;
   out_2701558932546138787[165] = 0;
   out_2701558932546138787[166] = 0;
   out_2701558932546138787[167] = 0;
   out_2701558932546138787[168] = 0;
   out_2701558932546138787[169] = 0;
   out_2701558932546138787[170] = 0;
   out_2701558932546138787[171] = 0;
   out_2701558932546138787[172] = 0;
   out_2701558932546138787[173] = 0;
   out_2701558932546138787[174] = 0;
   out_2701558932546138787[175] = 1.0;
   out_2701558932546138787[176] = 0;
   out_2701558932546138787[177] = 0;
   out_2701558932546138787[178] = 0;
   out_2701558932546138787[179] = 0;
   out_2701558932546138787[180] = 0;
   out_2701558932546138787[181] = 0;
   out_2701558932546138787[182] = 0;
   out_2701558932546138787[183] = 0;
   out_2701558932546138787[184] = 0;
   out_2701558932546138787[185] = 0;
   out_2701558932546138787[186] = 0;
   out_2701558932546138787[187] = 0;
   out_2701558932546138787[188] = 0;
   out_2701558932546138787[189] = 0;
   out_2701558932546138787[190] = 0;
   out_2701558932546138787[191] = 0;
   out_2701558932546138787[192] = 0;
   out_2701558932546138787[193] = 0;
   out_2701558932546138787[194] = 0;
   out_2701558932546138787[195] = 0;
   out_2701558932546138787[196] = 0;
   out_2701558932546138787[197] = 1.0;
   out_2701558932546138787[198] = 0;
   out_2701558932546138787[199] = 0;
   out_2701558932546138787[200] = 0;
   out_2701558932546138787[201] = 0;
   out_2701558932546138787[202] = 0;
   out_2701558932546138787[203] = 0;
   out_2701558932546138787[204] = 0;
   out_2701558932546138787[205] = 0;
   out_2701558932546138787[206] = 0;
   out_2701558932546138787[207] = 0;
   out_2701558932546138787[208] = 0;
   out_2701558932546138787[209] = 0;
   out_2701558932546138787[210] = 0;
   out_2701558932546138787[211] = 0;
   out_2701558932546138787[212] = 0;
   out_2701558932546138787[213] = 0;
   out_2701558932546138787[214] = 0;
   out_2701558932546138787[215] = 0;
   out_2701558932546138787[216] = 0;
   out_2701558932546138787[217] = 0;
   out_2701558932546138787[218] = 0;
   out_2701558932546138787[219] = 1.0;
   out_2701558932546138787[220] = 0;
   out_2701558932546138787[221] = 0;
   out_2701558932546138787[222] = 0;
   out_2701558932546138787[223] = 0;
   out_2701558932546138787[224] = 0;
   out_2701558932546138787[225] = 0;
   out_2701558932546138787[226] = 0;
   out_2701558932546138787[227] = 0;
   out_2701558932546138787[228] = 0;
   out_2701558932546138787[229] = 0;
   out_2701558932546138787[230] = 0;
   out_2701558932546138787[231] = 0;
   out_2701558932546138787[232] = 0;
   out_2701558932546138787[233] = 0;
   out_2701558932546138787[234] = 0;
   out_2701558932546138787[235] = 0;
   out_2701558932546138787[236] = 0;
   out_2701558932546138787[237] = 0;
   out_2701558932546138787[238] = 0;
   out_2701558932546138787[239] = 0;
   out_2701558932546138787[240] = 0;
   out_2701558932546138787[241] = 1.0;
   out_2701558932546138787[242] = 0;
   out_2701558932546138787[243] = 0;
   out_2701558932546138787[244] = 0;
   out_2701558932546138787[245] = 0;
   out_2701558932546138787[246] = 0;
   out_2701558932546138787[247] = 0;
   out_2701558932546138787[248] = 0;
   out_2701558932546138787[249] = 0;
   out_2701558932546138787[250] = 0;
   out_2701558932546138787[251] = 0;
   out_2701558932546138787[252] = 0;
   out_2701558932546138787[253] = 0;
   out_2701558932546138787[254] = 0;
   out_2701558932546138787[255] = 0;
   out_2701558932546138787[256] = 0;
   out_2701558932546138787[257] = 0;
   out_2701558932546138787[258] = 0;
   out_2701558932546138787[259] = 0;
   out_2701558932546138787[260] = 0;
   out_2701558932546138787[261] = 0;
   out_2701558932546138787[262] = 0;
   out_2701558932546138787[263] = 1.0;
   out_2701558932546138787[264] = 0;
   out_2701558932546138787[265] = 0;
   out_2701558932546138787[266] = 0;
   out_2701558932546138787[267] = 0;
   out_2701558932546138787[268] = 0;
   out_2701558932546138787[269] = 0;
   out_2701558932546138787[270] = 0;
   out_2701558932546138787[271] = 0;
   out_2701558932546138787[272] = 0;
   out_2701558932546138787[273] = 0;
   out_2701558932546138787[274] = 0;
   out_2701558932546138787[275] = 0;
   out_2701558932546138787[276] = 0;
   out_2701558932546138787[277] = 0;
   out_2701558932546138787[278] = 0;
   out_2701558932546138787[279] = 0;
   out_2701558932546138787[280] = 0;
   out_2701558932546138787[281] = 0;
   out_2701558932546138787[282] = 0;
   out_2701558932546138787[283] = 0;
   out_2701558932546138787[284] = 0;
   out_2701558932546138787[285] = 1.0;
   out_2701558932546138787[286] = 0;
   out_2701558932546138787[287] = 0;
   out_2701558932546138787[288] = 0;
   out_2701558932546138787[289] = 0;
   out_2701558932546138787[290] = 0;
   out_2701558932546138787[291] = 0;
   out_2701558932546138787[292] = 0;
   out_2701558932546138787[293] = 0;
   out_2701558932546138787[294] = 0;
   out_2701558932546138787[295] = 0;
   out_2701558932546138787[296] = 0;
   out_2701558932546138787[297] = 0;
   out_2701558932546138787[298] = 0;
   out_2701558932546138787[299] = 0;
   out_2701558932546138787[300] = 0;
   out_2701558932546138787[301] = 0;
   out_2701558932546138787[302] = 0;
   out_2701558932546138787[303] = 0;
   out_2701558932546138787[304] = 0;
   out_2701558932546138787[305] = 0;
   out_2701558932546138787[306] = 0;
   out_2701558932546138787[307] = 1.0;
   out_2701558932546138787[308] = 0;
   out_2701558932546138787[309] = 0;
   out_2701558932546138787[310] = 0;
   out_2701558932546138787[311] = 0;
   out_2701558932546138787[312] = 0;
   out_2701558932546138787[313] = 0;
   out_2701558932546138787[314] = 0;
   out_2701558932546138787[315] = 0;
   out_2701558932546138787[316] = 0;
   out_2701558932546138787[317] = 0;
   out_2701558932546138787[318] = 0;
   out_2701558932546138787[319] = 0;
   out_2701558932546138787[320] = 0;
   out_2701558932546138787[321] = 0;
   out_2701558932546138787[322] = 0;
   out_2701558932546138787[323] = 0;
   out_2701558932546138787[324] = 0;
   out_2701558932546138787[325] = 0;
   out_2701558932546138787[326] = 0;
   out_2701558932546138787[327] = 0;
   out_2701558932546138787[328] = 0;
   out_2701558932546138787[329] = 1.0;
   out_2701558932546138787[330] = 0;
   out_2701558932546138787[331] = 0;
   out_2701558932546138787[332] = 0;
   out_2701558932546138787[333] = 0;
   out_2701558932546138787[334] = 0;
   out_2701558932546138787[335] = 0;
   out_2701558932546138787[336] = 0;
   out_2701558932546138787[337] = 0;
   out_2701558932546138787[338] = 0;
   out_2701558932546138787[339] = 0;
   out_2701558932546138787[340] = 0;
   out_2701558932546138787[341] = 0;
   out_2701558932546138787[342] = 0;
   out_2701558932546138787[343] = 0;
   out_2701558932546138787[344] = 0;
   out_2701558932546138787[345] = 0;
   out_2701558932546138787[346] = 0;
   out_2701558932546138787[347] = 0;
   out_2701558932546138787[348] = 0;
   out_2701558932546138787[349] = 0;
   out_2701558932546138787[350] = 0;
   out_2701558932546138787[351] = 1.0;
   out_2701558932546138787[352] = 0;
   out_2701558932546138787[353] = 0;
   out_2701558932546138787[354] = 0;
   out_2701558932546138787[355] = 0;
   out_2701558932546138787[356] = 0;
   out_2701558932546138787[357] = 0;
   out_2701558932546138787[358] = 0;
   out_2701558932546138787[359] = 0;
   out_2701558932546138787[360] = 0;
   out_2701558932546138787[361] = 0;
   out_2701558932546138787[362] = 0;
   out_2701558932546138787[363] = 0;
   out_2701558932546138787[364] = 0;
   out_2701558932546138787[365] = 0;
   out_2701558932546138787[366] = 0;
   out_2701558932546138787[367] = 0;
   out_2701558932546138787[368] = 0;
   out_2701558932546138787[369] = 0;
   out_2701558932546138787[370] = 0;
   out_2701558932546138787[371] = 0;
   out_2701558932546138787[372] = 0;
   out_2701558932546138787[373] = 1.0;
   out_2701558932546138787[374] = 0;
   out_2701558932546138787[375] = 0;
   out_2701558932546138787[376] = 0;
   out_2701558932546138787[377] = 0;
   out_2701558932546138787[378] = 0;
   out_2701558932546138787[379] = 0;
   out_2701558932546138787[380] = 0;
   out_2701558932546138787[381] = 0;
   out_2701558932546138787[382] = 0;
   out_2701558932546138787[383] = 0;
   out_2701558932546138787[384] = 0;
   out_2701558932546138787[385] = 0;
   out_2701558932546138787[386] = 0;
   out_2701558932546138787[387] = 0;
   out_2701558932546138787[388] = 0;
   out_2701558932546138787[389] = 0;
   out_2701558932546138787[390] = 0;
   out_2701558932546138787[391] = 0;
   out_2701558932546138787[392] = 0;
   out_2701558932546138787[393] = 0;
   out_2701558932546138787[394] = 0;
   out_2701558932546138787[395] = 1.0;
   out_2701558932546138787[396] = 0;
   out_2701558932546138787[397] = 0;
   out_2701558932546138787[398] = 0;
   out_2701558932546138787[399] = 0;
   out_2701558932546138787[400] = 0;
   out_2701558932546138787[401] = 0;
   out_2701558932546138787[402] = 0;
   out_2701558932546138787[403] = 0;
   out_2701558932546138787[404] = 0;
   out_2701558932546138787[405] = 0;
   out_2701558932546138787[406] = 0;
   out_2701558932546138787[407] = 0;
   out_2701558932546138787[408] = 0;
   out_2701558932546138787[409] = 0;
   out_2701558932546138787[410] = 0;
   out_2701558932546138787[411] = 0;
   out_2701558932546138787[412] = 0;
   out_2701558932546138787[413] = 0;
   out_2701558932546138787[414] = 0;
   out_2701558932546138787[415] = 0;
   out_2701558932546138787[416] = 0;
   out_2701558932546138787[417] = 1.0;
   out_2701558932546138787[418] = 0;
   out_2701558932546138787[419] = 0;
   out_2701558932546138787[420] = 0;
   out_2701558932546138787[421] = 0;
   out_2701558932546138787[422] = 0;
   out_2701558932546138787[423] = 0;
   out_2701558932546138787[424] = 0;
   out_2701558932546138787[425] = 0;
   out_2701558932546138787[426] = 0;
   out_2701558932546138787[427] = 0;
   out_2701558932546138787[428] = 0;
   out_2701558932546138787[429] = 0;
   out_2701558932546138787[430] = 0;
   out_2701558932546138787[431] = 0;
   out_2701558932546138787[432] = 0;
   out_2701558932546138787[433] = 0;
   out_2701558932546138787[434] = 0;
   out_2701558932546138787[435] = 0;
   out_2701558932546138787[436] = 0;
   out_2701558932546138787[437] = 0;
   out_2701558932546138787[438] = 0;
   out_2701558932546138787[439] = 1.0;
   out_2701558932546138787[440] = 0;
   out_2701558932546138787[441] = 0;
   out_2701558932546138787[442] = 0;
   out_2701558932546138787[443] = 0;
   out_2701558932546138787[444] = 0;
   out_2701558932546138787[445] = 0;
   out_2701558932546138787[446] = 0;
   out_2701558932546138787[447] = 0;
   out_2701558932546138787[448] = 0;
   out_2701558932546138787[449] = 0;
   out_2701558932546138787[450] = 0;
   out_2701558932546138787[451] = 0;
   out_2701558932546138787[452] = 0;
   out_2701558932546138787[453] = 0;
   out_2701558932546138787[454] = 0;
   out_2701558932546138787[455] = 0;
   out_2701558932546138787[456] = 0;
   out_2701558932546138787[457] = 0;
   out_2701558932546138787[458] = 0;
   out_2701558932546138787[459] = 0;
   out_2701558932546138787[460] = 0;
   out_2701558932546138787[461] = 1.0;
}
void f_fun(double *state, double dt, double *out_3606051112273642094) {
   out_3606051112273642094[0] = dt*state[7] + state[0];
   out_3606051112273642094[1] = dt*state[8] + state[1];
   out_3606051112273642094[2] = dt*state[9] + state[2];
   out_3606051112273642094[3] = dt*(-0.5*state[4]*state[10] - 0.5*state[5]*state[11] - 0.5*state[6]*state[12]) + state[3];
   out_3606051112273642094[4] = dt*(0.5*state[3]*state[10] + 0.5*state[5]*state[12] - 0.5*state[6]*state[11]) + state[4];
   out_3606051112273642094[5] = dt*(0.5*state[3]*state[11] - 0.5*state[4]*state[12] + 0.5*state[6]*state[10]) + state[5];
   out_3606051112273642094[6] = dt*(0.5*state[3]*state[12] + 0.5*state[4]*state[11] - 0.5*state[5]*state[10]) + state[6];
   out_3606051112273642094[7] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]) + state[7];
   out_3606051112273642094[8] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]) + state[8];
   out_3606051112273642094[9] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]) + state[9];
   out_3606051112273642094[10] = state[10];
   out_3606051112273642094[11] = state[11];
   out_3606051112273642094[12] = state[12];
   out_3606051112273642094[13] = state[13];
   out_3606051112273642094[14] = state[14];
   out_3606051112273642094[15] = state[15];
   out_3606051112273642094[16] = state[16];
   out_3606051112273642094[17] = state[17];
   out_3606051112273642094[18] = state[18];
   out_3606051112273642094[19] = state[19];
   out_3606051112273642094[20] = state[20];
   out_3606051112273642094[21] = state[21];
}
void F_fun(double *state, double dt, double *out_2182973698110817430) {
   out_2182973698110817430[0] = 1;
   out_2182973698110817430[1] = 0;
   out_2182973698110817430[2] = 0;
   out_2182973698110817430[3] = 0;
   out_2182973698110817430[4] = 0;
   out_2182973698110817430[5] = 0;
   out_2182973698110817430[6] = dt;
   out_2182973698110817430[7] = 0;
   out_2182973698110817430[8] = 0;
   out_2182973698110817430[9] = 0;
   out_2182973698110817430[10] = 0;
   out_2182973698110817430[11] = 0;
   out_2182973698110817430[12] = 0;
   out_2182973698110817430[13] = 0;
   out_2182973698110817430[14] = 0;
   out_2182973698110817430[15] = 0;
   out_2182973698110817430[16] = 0;
   out_2182973698110817430[17] = 0;
   out_2182973698110817430[18] = 0;
   out_2182973698110817430[19] = 0;
   out_2182973698110817430[20] = 0;
   out_2182973698110817430[21] = 0;
   out_2182973698110817430[22] = 1;
   out_2182973698110817430[23] = 0;
   out_2182973698110817430[24] = 0;
   out_2182973698110817430[25] = 0;
   out_2182973698110817430[26] = 0;
   out_2182973698110817430[27] = 0;
   out_2182973698110817430[28] = dt;
   out_2182973698110817430[29] = 0;
   out_2182973698110817430[30] = 0;
   out_2182973698110817430[31] = 0;
   out_2182973698110817430[32] = 0;
   out_2182973698110817430[33] = 0;
   out_2182973698110817430[34] = 0;
   out_2182973698110817430[35] = 0;
   out_2182973698110817430[36] = 0;
   out_2182973698110817430[37] = 0;
   out_2182973698110817430[38] = 0;
   out_2182973698110817430[39] = 0;
   out_2182973698110817430[40] = 0;
   out_2182973698110817430[41] = 0;
   out_2182973698110817430[42] = 0;
   out_2182973698110817430[43] = 0;
   out_2182973698110817430[44] = 1;
   out_2182973698110817430[45] = 0;
   out_2182973698110817430[46] = 0;
   out_2182973698110817430[47] = 0;
   out_2182973698110817430[48] = 0;
   out_2182973698110817430[49] = 0;
   out_2182973698110817430[50] = dt;
   out_2182973698110817430[51] = 0;
   out_2182973698110817430[52] = 0;
   out_2182973698110817430[53] = 0;
   out_2182973698110817430[54] = 0;
   out_2182973698110817430[55] = 0;
   out_2182973698110817430[56] = 0;
   out_2182973698110817430[57] = 0;
   out_2182973698110817430[58] = 0;
   out_2182973698110817430[59] = 0;
   out_2182973698110817430[60] = 0;
   out_2182973698110817430[61] = 0;
   out_2182973698110817430[62] = 0;
   out_2182973698110817430[63] = 0;
   out_2182973698110817430[64] = 0;
   out_2182973698110817430[65] = 0;
   out_2182973698110817430[66] = 1;
   out_2182973698110817430[67] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[11] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]);
   out_2182973698110817430[68] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[12] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[10] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[11]);
   out_2182973698110817430[69] = 0;
   out_2182973698110817430[70] = 0;
   out_2182973698110817430[71] = 0;
   out_2182973698110817430[72] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
   out_2182973698110817430[73] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
   out_2182973698110817430[74] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
   out_2182973698110817430[75] = 0;
   out_2182973698110817430[76] = 0;
   out_2182973698110817430[77] = 0;
   out_2182973698110817430[78] = 0;
   out_2182973698110817430[79] = 0;
   out_2182973698110817430[80] = 0;
   out_2182973698110817430[81] = 0;
   out_2182973698110817430[82] = 0;
   out_2182973698110817430[83] = 0;
   out_2182973698110817430[84] = 0;
   out_2182973698110817430[85] = 0;
   out_2182973698110817430[86] = 0;
   out_2182973698110817430[87] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[11] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[10] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[12]);
   out_2182973698110817430[88] = 1;
   out_2182973698110817430[89] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[12] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[11] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[10]);
   out_2182973698110817430[90] = 0;
   out_2182973698110817430[91] = 0;
   out_2182973698110817430[92] = 0;
   out_2182973698110817430[93] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
   out_2182973698110817430[94] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
   out_2182973698110817430[95] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
   out_2182973698110817430[96] = 0;
   out_2182973698110817430[97] = 0;
   out_2182973698110817430[98] = 0;
   out_2182973698110817430[99] = 0;
   out_2182973698110817430[100] = 0;
   out_2182973698110817430[101] = 0;
   out_2182973698110817430[102] = 0;
   out_2182973698110817430[103] = 0;
   out_2182973698110817430[104] = 0;
   out_2182973698110817430[105] = 0;
   out_2182973698110817430[106] = 0;
   out_2182973698110817430[107] = 0;
   out_2182973698110817430[108] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[12] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[10] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[11]);
   out_2182973698110817430[109] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[12] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[11] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[10]);
   out_2182973698110817430[110] = 1;
   out_2182973698110817430[111] = 0;
   out_2182973698110817430[112] = 0;
   out_2182973698110817430[113] = 0;
   out_2182973698110817430[114] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
   out_2182973698110817430[115] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
   out_2182973698110817430[116] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
   out_2182973698110817430[117] = 0;
   out_2182973698110817430[118] = 0;
   out_2182973698110817430[119] = 0;
   out_2182973698110817430[120] = 0;
   out_2182973698110817430[121] = 0;
   out_2182973698110817430[122] = 0;
   out_2182973698110817430[123] = 0;
   out_2182973698110817430[124] = 0;
   out_2182973698110817430[125] = 0;
   out_2182973698110817430[126] = 0;
   out_2182973698110817430[127] = 0;
   out_2182973698110817430[128] = 0;
   out_2182973698110817430[129] = 0;
   out_2182973698110817430[130] = dt*((2*state[3]*state[4] + 2*state[5]*state[6])*state[17] + (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]);
   out_2182973698110817430[131] = dt*((2*state[3]*state[4] - 2*state[5]*state[6])*state[18] + (-2*state[3]*state[6] - 2*state[4]*state[5])*state[16] + (-pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[17]);
   out_2182973698110817430[132] = 1;
   out_2182973698110817430[133] = 0;
   out_2182973698110817430[134] = 0;
   out_2182973698110817430[135] = 0;
   out_2182973698110817430[136] = 0;
   out_2182973698110817430[137] = 0;
   out_2182973698110817430[138] = 0;
   out_2182973698110817430[139] = 0;
   out_2182973698110817430[140] = 0;
   out_2182973698110817430[141] = dt*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
   out_2182973698110817430[142] = dt*(-2*state[3]*state[6] + 2*state[4]*state[5]);
   out_2182973698110817430[143] = dt*(2*state[3]*state[5] + 2*state[4]*state[6]);
   out_2182973698110817430[144] = 0;
   out_2182973698110817430[145] = 0;
   out_2182973698110817430[146] = 0;
   out_2182973698110817430[147] = 0;
   out_2182973698110817430[148] = 0;
   out_2182973698110817430[149] = 0;
   out_2182973698110817430[150] = dt*(-(2*state[3]*state[4] + 2*state[5]*state[6])*state[17] - (-2*state[3]*state[5] + 2*state[4]*state[6])*state[16] - (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[18]);
   out_2182973698110817430[151] = 0;
   out_2182973698110817430[152] = dt*((2*state[3]*state[5] + 2*state[4]*state[6])*state[18] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[17] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[16]);
   out_2182973698110817430[153] = 0;
   out_2182973698110817430[154] = 1;
   out_2182973698110817430[155] = 0;
   out_2182973698110817430[156] = 0;
   out_2182973698110817430[157] = 0;
   out_2182973698110817430[158] = 0;
   out_2182973698110817430[159] = 0;
   out_2182973698110817430[160] = 0;
   out_2182973698110817430[161] = 0;
   out_2182973698110817430[162] = dt*(2*state[3]*state[6] + 2*state[4]*state[5]);
   out_2182973698110817430[163] = dt*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
   out_2182973698110817430[164] = dt*(-2*state[3]*state[4] + 2*state[5]*state[6]);
   out_2182973698110817430[165] = 0;
   out_2182973698110817430[166] = 0;
   out_2182973698110817430[167] = 0;
   out_2182973698110817430[168] = 0;
   out_2182973698110817430[169] = 0;
   out_2182973698110817430[170] = 0;
   out_2182973698110817430[171] = dt*((-2*state[3]*state[4] + 2*state[5]*state[6])*state[18] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[16] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[17]);
   out_2182973698110817430[172] = dt*((-2*state[3]*state[5] - 2*state[4]*state[6])*state[18] + (2*state[3]*state[6] - 2*state[4]*state[5])*state[17] + (-pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) + pow(state[6], 2))*state[16]);
   out_2182973698110817430[173] = 0;
   out_2182973698110817430[174] = 0;
   out_2182973698110817430[175] = 0;
   out_2182973698110817430[176] = 1;
   out_2182973698110817430[177] = 0;
   out_2182973698110817430[178] = 0;
   out_2182973698110817430[179] = 0;
   out_2182973698110817430[180] = 0;
   out_2182973698110817430[181] = 0;
   out_2182973698110817430[182] = 0;
   out_2182973698110817430[183] = dt*(-2*state[3]*state[5] + 2*state[4]*state[6]);
   out_2182973698110817430[184] = dt*(2*state[3]*state[4] + 2*state[5]*state[6]);
   out_2182973698110817430[185] = dt*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
   out_2182973698110817430[186] = 0;
   out_2182973698110817430[187] = 0;
   out_2182973698110817430[188] = 0;
   out_2182973698110817430[189] = 0;
   out_2182973698110817430[190] = 0;
   out_2182973698110817430[191] = 0;
   out_2182973698110817430[192] = 0;
   out_2182973698110817430[193] = 0;
   out_2182973698110817430[194] = 0;
   out_2182973698110817430[195] = 0;
   out_2182973698110817430[196] = 0;
   out_2182973698110817430[197] = 0;
   out_2182973698110817430[198] = 1;
   out_2182973698110817430[199] = 0;
   out_2182973698110817430[200] = 0;
   out_2182973698110817430[201] = 0;
   out_2182973698110817430[202] = 0;
   out_2182973698110817430[203] = 0;
   out_2182973698110817430[204] = 0;
   out_2182973698110817430[205] = 0;
   out_2182973698110817430[206] = 0;
   out_2182973698110817430[207] = 0;
   out_2182973698110817430[208] = 0;
   out_2182973698110817430[209] = 0;
   out_2182973698110817430[210] = 0;
   out_2182973698110817430[211] = 0;
   out_2182973698110817430[212] = 0;
   out_2182973698110817430[213] = 0;
   out_2182973698110817430[214] = 0;
   out_2182973698110817430[215] = 0;
   out_2182973698110817430[216] = 0;
   out_2182973698110817430[217] = 0;
   out_2182973698110817430[218] = 0;
   out_2182973698110817430[219] = 0;
   out_2182973698110817430[220] = 1;
   out_2182973698110817430[221] = 0;
   out_2182973698110817430[222] = 0;
   out_2182973698110817430[223] = 0;
   out_2182973698110817430[224] = 0;
   out_2182973698110817430[225] = 0;
   out_2182973698110817430[226] = 0;
   out_2182973698110817430[227] = 0;
   out_2182973698110817430[228] = 0;
   out_2182973698110817430[229] = 0;
   out_2182973698110817430[230] = 0;
   out_2182973698110817430[231] = 0;
   out_2182973698110817430[232] = 0;
   out_2182973698110817430[233] = 0;
   out_2182973698110817430[234] = 0;
   out_2182973698110817430[235] = 0;
   out_2182973698110817430[236] = 0;
   out_2182973698110817430[237] = 0;
   out_2182973698110817430[238] = 0;
   out_2182973698110817430[239] = 0;
   out_2182973698110817430[240] = 0;
   out_2182973698110817430[241] = 0;
   out_2182973698110817430[242] = 1;
   out_2182973698110817430[243] = 0;
   out_2182973698110817430[244] = 0;
   out_2182973698110817430[245] = 0;
   out_2182973698110817430[246] = 0;
   out_2182973698110817430[247] = 0;
   out_2182973698110817430[248] = 0;
   out_2182973698110817430[249] = 0;
   out_2182973698110817430[250] = 0;
   out_2182973698110817430[251] = 0;
   out_2182973698110817430[252] = 0;
   out_2182973698110817430[253] = 0;
   out_2182973698110817430[254] = 0;
   out_2182973698110817430[255] = 0;
   out_2182973698110817430[256] = 0;
   out_2182973698110817430[257] = 0;
   out_2182973698110817430[258] = 0;
   out_2182973698110817430[259] = 0;
   out_2182973698110817430[260] = 0;
   out_2182973698110817430[261] = 0;
   out_2182973698110817430[262] = 0;
   out_2182973698110817430[263] = 0;
   out_2182973698110817430[264] = 1;
   out_2182973698110817430[265] = 0;
   out_2182973698110817430[266] = 0;
   out_2182973698110817430[267] = 0;
   out_2182973698110817430[268] = 0;
   out_2182973698110817430[269] = 0;
   out_2182973698110817430[270] = 0;
   out_2182973698110817430[271] = 0;
   out_2182973698110817430[272] = 0;
   out_2182973698110817430[273] = 0;
   out_2182973698110817430[274] = 0;
   out_2182973698110817430[275] = 0;
   out_2182973698110817430[276] = 0;
   out_2182973698110817430[277] = 0;
   out_2182973698110817430[278] = 0;
   out_2182973698110817430[279] = 0;
   out_2182973698110817430[280] = 0;
   out_2182973698110817430[281] = 0;
   out_2182973698110817430[282] = 0;
   out_2182973698110817430[283] = 0;
   out_2182973698110817430[284] = 0;
   out_2182973698110817430[285] = 0;
   out_2182973698110817430[286] = 1;
   out_2182973698110817430[287] = 0;
   out_2182973698110817430[288] = 0;
   out_2182973698110817430[289] = 0;
   out_2182973698110817430[290] = 0;
   out_2182973698110817430[291] = 0;
   out_2182973698110817430[292] = 0;
   out_2182973698110817430[293] = 0;
   out_2182973698110817430[294] = 0;
   out_2182973698110817430[295] = 0;
   out_2182973698110817430[296] = 0;
   out_2182973698110817430[297] = 0;
   out_2182973698110817430[298] = 0;
   out_2182973698110817430[299] = 0;
   out_2182973698110817430[300] = 0;
   out_2182973698110817430[301] = 0;
   out_2182973698110817430[302] = 0;
   out_2182973698110817430[303] = 0;
   out_2182973698110817430[304] = 0;
   out_2182973698110817430[305] = 0;
   out_2182973698110817430[306] = 0;
   out_2182973698110817430[307] = 0;
   out_2182973698110817430[308] = 1;
   out_2182973698110817430[309] = 0;
   out_2182973698110817430[310] = 0;
   out_2182973698110817430[311] = 0;
   out_2182973698110817430[312] = 0;
   out_2182973698110817430[313] = 0;
   out_2182973698110817430[314] = 0;
   out_2182973698110817430[315] = 0;
   out_2182973698110817430[316] = 0;
   out_2182973698110817430[317] = 0;
   out_2182973698110817430[318] = 0;
   out_2182973698110817430[319] = 0;
   out_2182973698110817430[320] = 0;
   out_2182973698110817430[321] = 0;
   out_2182973698110817430[322] = 0;
   out_2182973698110817430[323] = 0;
   out_2182973698110817430[324] = 0;
   out_2182973698110817430[325] = 0;
   out_2182973698110817430[326] = 0;
   out_2182973698110817430[327] = 0;
   out_2182973698110817430[328] = 0;
   out_2182973698110817430[329] = 0;
   out_2182973698110817430[330] = 1;
   out_2182973698110817430[331] = 0;
   out_2182973698110817430[332] = 0;
   out_2182973698110817430[333] = 0;
   out_2182973698110817430[334] = 0;
   out_2182973698110817430[335] = 0;
   out_2182973698110817430[336] = 0;
   out_2182973698110817430[337] = 0;
   out_2182973698110817430[338] = 0;
   out_2182973698110817430[339] = 0;
   out_2182973698110817430[340] = 0;
   out_2182973698110817430[341] = 0;
   out_2182973698110817430[342] = 0;
   out_2182973698110817430[343] = 0;
   out_2182973698110817430[344] = 0;
   out_2182973698110817430[345] = 0;
   out_2182973698110817430[346] = 0;
   out_2182973698110817430[347] = 0;
   out_2182973698110817430[348] = 0;
   out_2182973698110817430[349] = 0;
   out_2182973698110817430[350] = 0;
   out_2182973698110817430[351] = 0;
   out_2182973698110817430[352] = 1;
   out_2182973698110817430[353] = 0;
   out_2182973698110817430[354] = 0;
   out_2182973698110817430[355] = 0;
   out_2182973698110817430[356] = 0;
   out_2182973698110817430[357] = 0;
   out_2182973698110817430[358] = 0;
   out_2182973698110817430[359] = 0;
   out_2182973698110817430[360] = 0;
   out_2182973698110817430[361] = 0;
   out_2182973698110817430[362] = 0;
   out_2182973698110817430[363] = 0;
   out_2182973698110817430[364] = 0;
   out_2182973698110817430[365] = 0;
   out_2182973698110817430[366] = 0;
   out_2182973698110817430[367] = 0;
   out_2182973698110817430[368] = 0;
   out_2182973698110817430[369] = 0;
   out_2182973698110817430[370] = 0;
   out_2182973698110817430[371] = 0;
   out_2182973698110817430[372] = 0;
   out_2182973698110817430[373] = 0;
   out_2182973698110817430[374] = 1;
   out_2182973698110817430[375] = 0;
   out_2182973698110817430[376] = 0;
   out_2182973698110817430[377] = 0;
   out_2182973698110817430[378] = 0;
   out_2182973698110817430[379] = 0;
   out_2182973698110817430[380] = 0;
   out_2182973698110817430[381] = 0;
   out_2182973698110817430[382] = 0;
   out_2182973698110817430[383] = 0;
   out_2182973698110817430[384] = 0;
   out_2182973698110817430[385] = 0;
   out_2182973698110817430[386] = 0;
   out_2182973698110817430[387] = 0;
   out_2182973698110817430[388] = 0;
   out_2182973698110817430[389] = 0;
   out_2182973698110817430[390] = 0;
   out_2182973698110817430[391] = 0;
   out_2182973698110817430[392] = 0;
   out_2182973698110817430[393] = 0;
   out_2182973698110817430[394] = 0;
   out_2182973698110817430[395] = 0;
   out_2182973698110817430[396] = 1;
   out_2182973698110817430[397] = 0;
   out_2182973698110817430[398] = 0;
   out_2182973698110817430[399] = 0;
   out_2182973698110817430[400] = 0;
   out_2182973698110817430[401] = 0;
   out_2182973698110817430[402] = 0;
   out_2182973698110817430[403] = 0;
   out_2182973698110817430[404] = 0;
   out_2182973698110817430[405] = 0;
   out_2182973698110817430[406] = 0;
   out_2182973698110817430[407] = 0;
   out_2182973698110817430[408] = 0;
   out_2182973698110817430[409] = 0;
   out_2182973698110817430[410] = 0;
   out_2182973698110817430[411] = 0;
   out_2182973698110817430[412] = 0;
   out_2182973698110817430[413] = 0;
   out_2182973698110817430[414] = 0;
   out_2182973698110817430[415] = 0;
   out_2182973698110817430[416] = 0;
   out_2182973698110817430[417] = 0;
   out_2182973698110817430[418] = 1;
   out_2182973698110817430[419] = 0;
   out_2182973698110817430[420] = 0;
   out_2182973698110817430[421] = 0;
   out_2182973698110817430[422] = 0;
   out_2182973698110817430[423] = 0;
   out_2182973698110817430[424] = 0;
   out_2182973698110817430[425] = 0;
   out_2182973698110817430[426] = 0;
   out_2182973698110817430[427] = 0;
   out_2182973698110817430[428] = 0;
   out_2182973698110817430[429] = 0;
   out_2182973698110817430[430] = 0;
   out_2182973698110817430[431] = 0;
   out_2182973698110817430[432] = 0;
   out_2182973698110817430[433] = 0;
   out_2182973698110817430[434] = 0;
   out_2182973698110817430[435] = 0;
   out_2182973698110817430[436] = 0;
   out_2182973698110817430[437] = 0;
   out_2182973698110817430[438] = 0;
   out_2182973698110817430[439] = 0;
   out_2182973698110817430[440] = 1;
}
void h_4(double *state, double *unused, double *out_8463469987022356377) {
   out_8463469987022356377[0] = state[10] + state[13];
   out_8463469987022356377[1] = state[11] + state[14];
   out_8463469987022356377[2] = state[12] + state[15];
}
void H_4(double *state, double *unused, double *out_5080240377932983361) {
   out_5080240377932983361[0] = 0;
   out_5080240377932983361[1] = 0;
   out_5080240377932983361[2] = 0;
   out_5080240377932983361[3] = 0;
   out_5080240377932983361[4] = 0;
   out_5080240377932983361[5] = 0;
   out_5080240377932983361[6] = 0;
   out_5080240377932983361[7] = 0;
   out_5080240377932983361[8] = 0;
   out_5080240377932983361[9] = 0;
   out_5080240377932983361[10] = 1;
   out_5080240377932983361[11] = 0;
   out_5080240377932983361[12] = 0;
   out_5080240377932983361[13] = 1;
   out_5080240377932983361[14] = 0;
   out_5080240377932983361[15] = 0;
   out_5080240377932983361[16] = 0;
   out_5080240377932983361[17] = 0;
   out_5080240377932983361[18] = 0;
   out_5080240377932983361[19] = 0;
   out_5080240377932983361[20] = 0;
   out_5080240377932983361[21] = 0;
   out_5080240377932983361[22] = 0;
   out_5080240377932983361[23] = 0;
   out_5080240377932983361[24] = 0;
   out_5080240377932983361[25] = 0;
   out_5080240377932983361[26] = 0;
   out_5080240377932983361[27] = 0;
   out_5080240377932983361[28] = 0;
   out_5080240377932983361[29] = 0;
   out_5080240377932983361[30] = 0;
   out_5080240377932983361[31] = 0;
   out_5080240377932983361[32] = 0;
   out_5080240377932983361[33] = 1;
   out_5080240377932983361[34] = 0;
   out_5080240377932983361[35] = 0;
   out_5080240377932983361[36] = 1;
   out_5080240377932983361[37] = 0;
   out_5080240377932983361[38] = 0;
   out_5080240377932983361[39] = 0;
   out_5080240377932983361[40] = 0;
   out_5080240377932983361[41] = 0;
   out_5080240377932983361[42] = 0;
   out_5080240377932983361[43] = 0;
   out_5080240377932983361[44] = 0;
   out_5080240377932983361[45] = 0;
   out_5080240377932983361[46] = 0;
   out_5080240377932983361[47] = 0;
   out_5080240377932983361[48] = 0;
   out_5080240377932983361[49] = 0;
   out_5080240377932983361[50] = 0;
   out_5080240377932983361[51] = 0;
   out_5080240377932983361[52] = 0;
   out_5080240377932983361[53] = 0;
   out_5080240377932983361[54] = 0;
   out_5080240377932983361[55] = 0;
   out_5080240377932983361[56] = 1;
   out_5080240377932983361[57] = 0;
   out_5080240377932983361[58] = 0;
   out_5080240377932983361[59] = 1;
   out_5080240377932983361[60] = 0;
   out_5080240377932983361[61] = 0;
   out_5080240377932983361[62] = 0;
   out_5080240377932983361[63] = 0;
   out_5080240377932983361[64] = 0;
   out_5080240377932983361[65] = 0;
}
void h_9(double *state, double *unused, double *out_2786992525549697552) {
   out_2786992525549697552[0] = state[10];
   out_2786992525549697552[1] = state[11];
   out_2786992525549697552[2] = state[12];
}
void H_9(double *state, double *unused, double *out_5321430024562574006) {
   out_5321430024562574006[0] = 0;
   out_5321430024562574006[1] = 0;
   out_5321430024562574006[2] = 0;
   out_5321430024562574006[3] = 0;
   out_5321430024562574006[4] = 0;
   out_5321430024562574006[5] = 0;
   out_5321430024562574006[6] = 0;
   out_5321430024562574006[7] = 0;
   out_5321430024562574006[8] = 0;
   out_5321430024562574006[9] = 0;
   out_5321430024562574006[10] = 1;
   out_5321430024562574006[11] = 0;
   out_5321430024562574006[12] = 0;
   out_5321430024562574006[13] = 0;
   out_5321430024562574006[14] = 0;
   out_5321430024562574006[15] = 0;
   out_5321430024562574006[16] = 0;
   out_5321430024562574006[17] = 0;
   out_5321430024562574006[18] = 0;
   out_5321430024562574006[19] = 0;
   out_5321430024562574006[20] = 0;
   out_5321430024562574006[21] = 0;
   out_5321430024562574006[22] = 0;
   out_5321430024562574006[23] = 0;
   out_5321430024562574006[24] = 0;
   out_5321430024562574006[25] = 0;
   out_5321430024562574006[26] = 0;
   out_5321430024562574006[27] = 0;
   out_5321430024562574006[28] = 0;
   out_5321430024562574006[29] = 0;
   out_5321430024562574006[30] = 0;
   out_5321430024562574006[31] = 0;
   out_5321430024562574006[32] = 0;
   out_5321430024562574006[33] = 1;
   out_5321430024562574006[34] = 0;
   out_5321430024562574006[35] = 0;
   out_5321430024562574006[36] = 0;
   out_5321430024562574006[37] = 0;
   out_5321430024562574006[38] = 0;
   out_5321430024562574006[39] = 0;
   out_5321430024562574006[40] = 0;
   out_5321430024562574006[41] = 0;
   out_5321430024562574006[42] = 0;
   out_5321430024562574006[43] = 0;
   out_5321430024562574006[44] = 0;
   out_5321430024562574006[45] = 0;
   out_5321430024562574006[46] = 0;
   out_5321430024562574006[47] = 0;
   out_5321430024562574006[48] = 0;
   out_5321430024562574006[49] = 0;
   out_5321430024562574006[50] = 0;
   out_5321430024562574006[51] = 0;
   out_5321430024562574006[52] = 0;
   out_5321430024562574006[53] = 0;
   out_5321430024562574006[54] = 0;
   out_5321430024562574006[55] = 0;
   out_5321430024562574006[56] = 1;
   out_5321430024562574006[57] = 0;
   out_5321430024562574006[58] = 0;
   out_5321430024562574006[59] = 0;
   out_5321430024562574006[60] = 0;
   out_5321430024562574006[61] = 0;
   out_5321430024562574006[62] = 0;
   out_5321430024562574006[63] = 0;
   out_5321430024562574006[64] = 0;
   out_5321430024562574006[65] = 0;
}
void h_10(double *state, double *unused, double *out_8379412946135224056) {
   out_8379412946135224056[0] = 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0] + state[16] + state[19];
   out_8379412946135224056[1] = 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2] + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1] + state[17] + state[20];
   out_8379412946135224056[2] = 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1] + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0] + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[2] + state[18] + state[21];
}
void H_10(double *state, double *unused, double *out_6888199329645064621) {
   out_6888199329645064621[0] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*pow(state[0], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2));
   out_6888199329645064621[1] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1];
   out_6888199329645064621[2] = -1195801500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(-2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[0]*state[2];
   out_6888199329645064621[3] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
   out_6888199329645064621[4] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
   out_6888199329645064621[5] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
   out_6888199329645064621[6] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
   out_6888199329645064621[7] = 0;
   out_6888199329645064621[8] = 0;
   out_6888199329645064621[9] = 0;
   out_6888199329645064621[10] = 0;
   out_6888199329645064621[11] = 0;
   out_6888199329645064621[12] = 0;
   out_6888199329645064621[13] = 0;
   out_6888199329645064621[14] = 0;
   out_6888199329645064621[15] = 0;
   out_6888199329645064621[16] = 1;
   out_6888199329645064621[17] = 0;
   out_6888199329645064621[18] = 0;
   out_6888199329645064621[19] = 1;
   out_6888199329645064621[20] = 0;
   out_6888199329645064621[21] = 0;
   out_6888199329645064621[22] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[0]*state[1];
   out_6888199329645064621[23] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*pow(state[1], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2));
   out_6888199329645064621[24] = -1195801500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[2], 2) + 398600500000000.0*(2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(-2*state[3]*state[6] + 2*state[4]*state[5])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[1]*state[2];
   out_6888199329645064621[25] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
   out_6888199329645064621[26] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
   out_6888199329645064621[27] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
   out_6888199329645064621[28] = -797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
   out_6888199329645064621[29] = 0;
   out_6888199329645064621[30] = 0;
   out_6888199329645064621[31] = 0;
   out_6888199329645064621[32] = 0;
   out_6888199329645064621[33] = 0;
   out_6888199329645064621[34] = 0;
   out_6888199329645064621[35] = 0;
   out_6888199329645064621[36] = 0;
   out_6888199329645064621[37] = 0;
   out_6888199329645064621[38] = 0;
   out_6888199329645064621[39] = 1;
   out_6888199329645064621[40] = 0;
   out_6888199329645064621[41] = 0;
   out_6888199329645064621[42] = 1;
   out_6888199329645064621[43] = 0;
   out_6888199329645064621[44] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[0], 2) + 398600500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[0]*state[2];
   out_6888199329645064621[45] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*pow(state[1], 2) + 398600500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5) - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[1] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[1]*state[2];
   out_6888199329645064621[46] = -1195801500000000.0*(-2*state[3]*state[4] + 2*state[5]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[1]*state[2] - 1195801500000000.0*(2*state[3]*state[5] + 2*state[4]*state[6])*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*state[0]*state[2] - 1195801500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -2.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*pow(state[2], 2) + 398600500000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*(pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2));
   out_6888199329645064621[47] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[5] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[3];
   out_6888199329645064621[48] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[3] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[4];
   out_6888199329645064621[49] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[3] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[6] - 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[5];
   out_6888199329645064621[50] = 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[0]*state[4] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[1]*state[5] + 797201000000000.0*pow(pow(state[0], 2) + pow(state[1], 2) + pow(state[2], 2), -1.5)*state[2]*state[6];
   out_6888199329645064621[51] = 0;
   out_6888199329645064621[52] = 0;
   out_6888199329645064621[53] = 0;
   out_6888199329645064621[54] = 0;
   out_6888199329645064621[55] = 0;
   out_6888199329645064621[56] = 0;
   out_6888199329645064621[57] = 0;
   out_6888199329645064621[58] = 0;
   out_6888199329645064621[59] = 0;
   out_6888199329645064621[60] = 0;
   out_6888199329645064621[61] = 0;
   out_6888199329645064621[62] = 1;
   out_6888199329645064621[63] = 0;
   out_6888199329645064621[64] = 0;
   out_6888199329645064621[65] = 1;
}
void h_12(double *state, double *unused, double *out_5262287356934284136) {
   out_5262287356934284136[0] = state[0];
   out_5262287356934284136[1] = state[1];
   out_5262287356934284136[2] = state[2];
}
void H_12(double *state, double *unused, double *out_8347047287744606460) {
   out_8347047287744606460[0] = 1;
   out_8347047287744606460[1] = 0;
   out_8347047287744606460[2] = 0;
   out_8347047287744606460[3] = 0;
   out_8347047287744606460[4] = 0;
   out_8347047287744606460[5] = 0;
   out_8347047287744606460[6] = 0;
   out_8347047287744606460[7] = 0;
   out_8347047287744606460[8] = 0;
   out_8347047287744606460[9] = 0;
   out_8347047287744606460[10] = 0;
   out_8347047287744606460[11] = 0;
   out_8347047287744606460[12] = 0;
   out_8347047287744606460[13] = 0;
   out_8347047287744606460[14] = 0;
   out_8347047287744606460[15] = 0;
   out_8347047287744606460[16] = 0;
   out_8347047287744606460[17] = 0;
   out_8347047287744606460[18] = 0;
   out_8347047287744606460[19] = 0;
   out_8347047287744606460[20] = 0;
   out_8347047287744606460[21] = 0;
   out_8347047287744606460[22] = 0;
   out_8347047287744606460[23] = 1;
   out_8347047287744606460[24] = 0;
   out_8347047287744606460[25] = 0;
   out_8347047287744606460[26] = 0;
   out_8347047287744606460[27] = 0;
   out_8347047287744606460[28] = 0;
   out_8347047287744606460[29] = 0;
   out_8347047287744606460[30] = 0;
   out_8347047287744606460[31] = 0;
   out_8347047287744606460[32] = 0;
   out_8347047287744606460[33] = 0;
   out_8347047287744606460[34] = 0;
   out_8347047287744606460[35] = 0;
   out_8347047287744606460[36] = 0;
   out_8347047287744606460[37] = 0;
   out_8347047287744606460[38] = 0;
   out_8347047287744606460[39] = 0;
   out_8347047287744606460[40] = 0;
   out_8347047287744606460[41] = 0;
   out_8347047287744606460[42] = 0;
   out_8347047287744606460[43] = 0;
   out_8347047287744606460[44] = 0;
   out_8347047287744606460[45] = 0;
   out_8347047287744606460[46] = 1;
   out_8347047287744606460[47] = 0;
   out_8347047287744606460[48] = 0;
   out_8347047287744606460[49] = 0;
   out_8347047287744606460[50] = 0;
   out_8347047287744606460[51] = 0;
   out_8347047287744606460[52] = 0;
   out_8347047287744606460[53] = 0;
   out_8347047287744606460[54] = 0;
   out_8347047287744606460[55] = 0;
   out_8347047287744606460[56] = 0;
   out_8347047287744606460[57] = 0;
   out_8347047287744606460[58] = 0;
   out_8347047287744606460[59] = 0;
   out_8347047287744606460[60] = 0;
   out_8347047287744606460[61] = 0;
   out_8347047287744606460[62] = 0;
   out_8347047287744606460[63] = 0;
   out_8347047287744606460[64] = 0;
   out_8347047287744606460[65] = 0;
}
void h_35(double *state, double *unused, double *out_4834460567699992938) {
   out_4834460567699992938[0] = state[7];
   out_4834460567699992938[1] = state[8];
   out_4834460567699992938[2] = state[9];
}
void H_35(double *state, double *unused, double *out_8446902435305590737) {
   out_8446902435305590737[0] = 0;
   out_8446902435305590737[1] = 0;
   out_8446902435305590737[2] = 0;
   out_8446902435305590737[3] = 0;
   out_8446902435305590737[4] = 0;
   out_8446902435305590737[5] = 0;
   out_8446902435305590737[6] = 0;
   out_8446902435305590737[7] = 1;
   out_8446902435305590737[8] = 0;
   out_8446902435305590737[9] = 0;
   out_8446902435305590737[10] = 0;
   out_8446902435305590737[11] = 0;
   out_8446902435305590737[12] = 0;
   out_8446902435305590737[13] = 0;
   out_8446902435305590737[14] = 0;
   out_8446902435305590737[15] = 0;
   out_8446902435305590737[16] = 0;
   out_8446902435305590737[17] = 0;
   out_8446902435305590737[18] = 0;
   out_8446902435305590737[19] = 0;
   out_8446902435305590737[20] = 0;
   out_8446902435305590737[21] = 0;
   out_8446902435305590737[22] = 0;
   out_8446902435305590737[23] = 0;
   out_8446902435305590737[24] = 0;
   out_8446902435305590737[25] = 0;
   out_8446902435305590737[26] = 0;
   out_8446902435305590737[27] = 0;
   out_8446902435305590737[28] = 0;
   out_8446902435305590737[29] = 0;
   out_8446902435305590737[30] = 1;
   out_8446902435305590737[31] = 0;
   out_8446902435305590737[32] = 0;
   out_8446902435305590737[33] = 0;
   out_8446902435305590737[34] = 0;
   out_8446902435305590737[35] = 0;
   out_8446902435305590737[36] = 0;
   out_8446902435305590737[37] = 0;
   out_8446902435305590737[38] = 0;
   out_8446902435305590737[39] = 0;
   out_8446902435305590737[40] = 0;
   out_8446902435305590737[41] = 0;
   out_8446902435305590737[42] = 0;
   out_8446902435305590737[43] = 0;
   out_8446902435305590737[44] = 0;
   out_8446902435305590737[45] = 0;
   out_8446902435305590737[46] = 0;
   out_8446902435305590737[47] = 0;
   out_8446902435305590737[48] = 0;
   out_8446902435305590737[49] = 0;
   out_8446902435305590737[50] = 0;
   out_8446902435305590737[51] = 0;
   out_8446902435305590737[52] = 0;
   out_8446902435305590737[53] = 1;
   out_8446902435305590737[54] = 0;
   out_8446902435305590737[55] = 0;
   out_8446902435305590737[56] = 0;
   out_8446902435305590737[57] = 0;
   out_8446902435305590737[58] = 0;
   out_8446902435305590737[59] = 0;
   out_8446902435305590737[60] = 0;
   out_8446902435305590737[61] = 0;
   out_8446902435305590737[62] = 0;
   out_8446902435305590737[63] = 0;
   out_8446902435305590737[64] = 0;
   out_8446902435305590737[65] = 0;
}
void h_32(double *state, double *unused, double *out_1718054444930970599) {
   out_1718054444930970599[0] = state[3];
   out_1718054444930970599[1] = state[4];
   out_1718054444930970599[2] = state[5];
   out_1718054444930970599[3] = state[6];
}
void H_32(double *state, double *unused, double *out_6802062925594691135) {
   out_6802062925594691135[0] = 0;
   out_6802062925594691135[1] = 0;
   out_6802062925594691135[2] = 0;
   out_6802062925594691135[3] = 1;
   out_6802062925594691135[4] = 0;
   out_6802062925594691135[5] = 0;
   out_6802062925594691135[6] = 0;
   out_6802062925594691135[7] = 0;
   out_6802062925594691135[8] = 0;
   out_6802062925594691135[9] = 0;
   out_6802062925594691135[10] = 0;
   out_6802062925594691135[11] = 0;
   out_6802062925594691135[12] = 0;
   out_6802062925594691135[13] = 0;
   out_6802062925594691135[14] = 0;
   out_6802062925594691135[15] = 0;
   out_6802062925594691135[16] = 0;
   out_6802062925594691135[17] = 0;
   out_6802062925594691135[18] = 0;
   out_6802062925594691135[19] = 0;
   out_6802062925594691135[20] = 0;
   out_6802062925594691135[21] = 0;
   out_6802062925594691135[22] = 0;
   out_6802062925594691135[23] = 0;
   out_6802062925594691135[24] = 0;
   out_6802062925594691135[25] = 0;
   out_6802062925594691135[26] = 1;
   out_6802062925594691135[27] = 0;
   out_6802062925594691135[28] = 0;
   out_6802062925594691135[29] = 0;
   out_6802062925594691135[30] = 0;
   out_6802062925594691135[31] = 0;
   out_6802062925594691135[32] = 0;
   out_6802062925594691135[33] = 0;
   out_6802062925594691135[34] = 0;
   out_6802062925594691135[35] = 0;
   out_6802062925594691135[36] = 0;
   out_6802062925594691135[37] = 0;
   out_6802062925594691135[38] = 0;
   out_6802062925594691135[39] = 0;
   out_6802062925594691135[40] = 0;
   out_6802062925594691135[41] = 0;
   out_6802062925594691135[42] = 0;
   out_6802062925594691135[43] = 0;
   out_6802062925594691135[44] = 0;
   out_6802062925594691135[45] = 0;
   out_6802062925594691135[46] = 0;
   out_6802062925594691135[47] = 0;
   out_6802062925594691135[48] = 0;
   out_6802062925594691135[49] = 1;
   out_6802062925594691135[50] = 0;
   out_6802062925594691135[51] = 0;
   out_6802062925594691135[52] = 0;
   out_6802062925594691135[53] = 0;
   out_6802062925594691135[54] = 0;
   out_6802062925594691135[55] = 0;
   out_6802062925594691135[56] = 0;
   out_6802062925594691135[57] = 0;
   out_6802062925594691135[58] = 0;
   out_6802062925594691135[59] = 0;
   out_6802062925594691135[60] = 0;
   out_6802062925594691135[61] = 0;
   out_6802062925594691135[62] = 0;
   out_6802062925594691135[63] = 0;
   out_6802062925594691135[64] = 0;
   out_6802062925594691135[65] = 0;
   out_6802062925594691135[66] = 0;
   out_6802062925594691135[67] = 0;
   out_6802062925594691135[68] = 0;
   out_6802062925594691135[69] = 0;
   out_6802062925594691135[70] = 0;
   out_6802062925594691135[71] = 0;
   out_6802062925594691135[72] = 1;
   out_6802062925594691135[73] = 0;
   out_6802062925594691135[74] = 0;
   out_6802062925594691135[75] = 0;
   out_6802062925594691135[76] = 0;
   out_6802062925594691135[77] = 0;
   out_6802062925594691135[78] = 0;
   out_6802062925594691135[79] = 0;
   out_6802062925594691135[80] = 0;
   out_6802062925594691135[81] = 0;
   out_6802062925594691135[82] = 0;
   out_6802062925594691135[83] = 0;
   out_6802062925594691135[84] = 0;
   out_6802062925594691135[85] = 0;
   out_6802062925594691135[86] = 0;
   out_6802062925594691135[87] = 0;
}
void h_13(double *state, double *unused, double *out_2804481356306676794) {
   out_2804481356306676794[0] = (-2*state[3]*state[5] + 2*state[4]*state[6])*state[9] + (2*state[3]*state[6] + 2*state[4]*state[5])*state[8] + (pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2))*state[7];
   out_2804481356306676794[1] = (2*state[3]*state[4] + 2*state[5]*state[6])*state[9] + (-2*state[3]*state[6] + 2*state[4]*state[5])*state[7] + (pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2))*state[8];
   out_2804481356306676794[2] = (-2*state[3]*state[4] + 2*state[5]*state[6])*state[8] + (2*state[3]*state[5] + 2*state[4]*state[6])*state[7] + (pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2))*state[9];
}
void H_13(double *state, double *unused, double *out_6190083131893926822) {
   out_6190083131893926822[0] = 0;
   out_6190083131893926822[1] = 0;
   out_6190083131893926822[2] = 0;
   out_6190083131893926822[3] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
   out_6190083131893926822[4] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
   out_6190083131893926822[5] = -2*state[3]*state[9] + 2*state[4]*state[8] - 2*state[5]*state[7];
   out_6190083131893926822[6] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
   out_6190083131893926822[7] = pow(state[3], 2) + pow(state[4], 2) - pow(state[5], 2) - pow(state[6], 2);
   out_6190083131893926822[8] = 2*state[3]*state[6] + 2*state[4]*state[5];
   out_6190083131893926822[9] = -2*state[3]*state[5] + 2*state[4]*state[6];
   out_6190083131893926822[10] = 0;
   out_6190083131893926822[11] = 0;
   out_6190083131893926822[12] = 0;
   out_6190083131893926822[13] = 0;
   out_6190083131893926822[14] = 0;
   out_6190083131893926822[15] = 0;
   out_6190083131893926822[16] = 0;
   out_6190083131893926822[17] = 0;
   out_6190083131893926822[18] = 0;
   out_6190083131893926822[19] = 0;
   out_6190083131893926822[20] = 0;
   out_6190083131893926822[21] = 0;
   out_6190083131893926822[22] = 0;
   out_6190083131893926822[23] = 0;
   out_6190083131893926822[24] = 0;
   out_6190083131893926822[25] = 2*state[3]*state[8] + 2*state[4]*state[9] - 2*state[6]*state[7];
   out_6190083131893926822[26] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
   out_6190083131893926822[27] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
   out_6190083131893926822[28] = -2*state[3]*state[7] + 2*state[5]*state[9] - 2*state[6]*state[8];
   out_6190083131893926822[29] = -2*state[3]*state[6] + 2*state[4]*state[5];
   out_6190083131893926822[30] = pow(state[3], 2) - pow(state[4], 2) + pow(state[5], 2) - pow(state[6], 2);
   out_6190083131893926822[31] = 2*state[3]*state[4] + 2*state[5]*state[6];
   out_6190083131893926822[32] = 0;
   out_6190083131893926822[33] = 0;
   out_6190083131893926822[34] = 0;
   out_6190083131893926822[35] = 0;
   out_6190083131893926822[36] = 0;
   out_6190083131893926822[37] = 0;
   out_6190083131893926822[38] = 0;
   out_6190083131893926822[39] = 0;
   out_6190083131893926822[40] = 0;
   out_6190083131893926822[41] = 0;
   out_6190083131893926822[42] = 0;
   out_6190083131893926822[43] = 0;
   out_6190083131893926822[44] = 0;
   out_6190083131893926822[45] = 0;
   out_6190083131893926822[46] = 0;
   out_6190083131893926822[47] = 2*state[3]*state[9] - 2*state[4]*state[8] + 2*state[5]*state[7];
   out_6190083131893926822[48] = -2*state[3]*state[8] - 2*state[4]*state[9] + 2*state[6]*state[7];
   out_6190083131893926822[49] = 2*state[3]*state[7] - 2*state[5]*state[9] + 2*state[6]*state[8];
   out_6190083131893926822[50] = 2*state[4]*state[7] + 2*state[5]*state[8] + 2*state[6]*state[9];
   out_6190083131893926822[51] = 2*state[3]*state[5] + 2*state[4]*state[6];
   out_6190083131893926822[52] = -2*state[3]*state[4] + 2*state[5]*state[6];
   out_6190083131893926822[53] = pow(state[3], 2) - pow(state[4], 2) - pow(state[5], 2) + pow(state[6], 2);
   out_6190083131893926822[54] = 0;
   out_6190083131893926822[55] = 0;
   out_6190083131893926822[56] = 0;
   out_6190083131893926822[57] = 0;
   out_6190083131893926822[58] = 0;
   out_6190083131893926822[59] = 0;
   out_6190083131893926822[60] = 0;
   out_6190083131893926822[61] = 0;
   out_6190083131893926822[62] = 0;
   out_6190083131893926822[63] = 0;
   out_6190083131893926822[64] = 0;
   out_6190083131893926822[65] = 0;
}
void h_14(double *state, double *unused, double *out_2786992525549697552) {
   out_2786992525549697552[0] = state[10];
   out_2786992525549697552[1] = state[11];
   out_2786992525549697552[2] = state[12];
}
void H_14(double *state, double *unused, double *out_5321430024562574006) {
   out_5321430024562574006[0] = 0;
   out_5321430024562574006[1] = 0;
   out_5321430024562574006[2] = 0;
   out_5321430024562574006[3] = 0;
   out_5321430024562574006[4] = 0;
   out_5321430024562574006[5] = 0;
   out_5321430024562574006[6] = 0;
   out_5321430024562574006[7] = 0;
   out_5321430024562574006[8] = 0;
   out_5321430024562574006[9] = 0;
   out_5321430024562574006[10] = 1;
   out_5321430024562574006[11] = 0;
   out_5321430024562574006[12] = 0;
   out_5321430024562574006[13] = 0;
   out_5321430024562574006[14] = 0;
   out_5321430024562574006[15] = 0;
   out_5321430024562574006[16] = 0;
   out_5321430024562574006[17] = 0;
   out_5321430024562574006[18] = 0;
   out_5321430024562574006[19] = 0;
   out_5321430024562574006[20] = 0;
   out_5321430024562574006[21] = 0;
   out_5321430024562574006[22] = 0;
   out_5321430024562574006[23] = 0;
   out_5321430024562574006[24] = 0;
   out_5321430024562574006[25] = 0;
   out_5321430024562574006[26] = 0;
   out_5321430024562574006[27] = 0;
   out_5321430024562574006[28] = 0;
   out_5321430024562574006[29] = 0;
   out_5321430024562574006[30] = 0;
   out_5321430024562574006[31] = 0;
   out_5321430024562574006[32] = 0;
   out_5321430024562574006[33] = 1;
   out_5321430024562574006[34] = 0;
   out_5321430024562574006[35] = 0;
   out_5321430024562574006[36] = 0;
   out_5321430024562574006[37] = 0;
   out_5321430024562574006[38] = 0;
   out_5321430024562574006[39] = 0;
   out_5321430024562574006[40] = 0;
   out_5321430024562574006[41] = 0;
   out_5321430024562574006[42] = 0;
   out_5321430024562574006[43] = 0;
   out_5321430024562574006[44] = 0;
   out_5321430024562574006[45] = 0;
   out_5321430024562574006[46] = 0;
   out_5321430024562574006[47] = 0;
   out_5321430024562574006[48] = 0;
   out_5321430024562574006[49] = 0;
   out_5321430024562574006[50] = 0;
   out_5321430024562574006[51] = 0;
   out_5321430024562574006[52] = 0;
   out_5321430024562574006[53] = 0;
   out_5321430024562574006[54] = 0;
   out_5321430024562574006[55] = 0;
   out_5321430024562574006[56] = 1;
   out_5321430024562574006[57] = 0;
   out_5321430024562574006[58] = 0;
   out_5321430024562574006[59] = 0;
   out_5321430024562574006[60] = 0;
   out_5321430024562574006[61] = 0;
   out_5321430024562574006[62] = 0;
   out_5321430024562574006[63] = 0;
   out_5321430024562574006[64] = 0;
   out_5321430024562574006[65] = 0;
}
void h_33(double *state, double *unused, double *out_2458995549900816337) {
   out_2458995549900816337[0] = state[16];
   out_2458995549900816337[1] = state[17];
   out_2458995549900816337[2] = state[18];
}
void H_33(double *state, double *unused, double *out_6849284633765103275) {
   out_6849284633765103275[0] = 0;
   out_6849284633765103275[1] = 0;
   out_6849284633765103275[2] = 0;
   out_6849284633765103275[3] = 0;
   out_6849284633765103275[4] = 0;
   out_6849284633765103275[5] = 0;
   out_6849284633765103275[6] = 0;
   out_6849284633765103275[7] = 0;
   out_6849284633765103275[8] = 0;
   out_6849284633765103275[9] = 0;
   out_6849284633765103275[10] = 0;
   out_6849284633765103275[11] = 0;
   out_6849284633765103275[12] = 0;
   out_6849284633765103275[13] = 0;
   out_6849284633765103275[14] = 0;
   out_6849284633765103275[15] = 0;
   out_6849284633765103275[16] = 1;
   out_6849284633765103275[17] = 0;
   out_6849284633765103275[18] = 0;
   out_6849284633765103275[19] = 0;
   out_6849284633765103275[20] = 0;
   out_6849284633765103275[21] = 0;
   out_6849284633765103275[22] = 0;
   out_6849284633765103275[23] = 0;
   out_6849284633765103275[24] = 0;
   out_6849284633765103275[25] = 0;
   out_6849284633765103275[26] = 0;
   out_6849284633765103275[27] = 0;
   out_6849284633765103275[28] = 0;
   out_6849284633765103275[29] = 0;
   out_6849284633765103275[30] = 0;
   out_6849284633765103275[31] = 0;
   out_6849284633765103275[32] = 0;
   out_6849284633765103275[33] = 0;
   out_6849284633765103275[34] = 0;
   out_6849284633765103275[35] = 0;
   out_6849284633765103275[36] = 0;
   out_6849284633765103275[37] = 0;
   out_6849284633765103275[38] = 0;
   out_6849284633765103275[39] = 1;
   out_6849284633765103275[40] = 0;
   out_6849284633765103275[41] = 0;
   out_6849284633765103275[42] = 0;
   out_6849284633765103275[43] = 0;
   out_6849284633765103275[44] = 0;
   out_6849284633765103275[45] = 0;
   out_6849284633765103275[46] = 0;
   out_6849284633765103275[47] = 0;
   out_6849284633765103275[48] = 0;
   out_6849284633765103275[49] = 0;
   out_6849284633765103275[50] = 0;
   out_6849284633765103275[51] = 0;
   out_6849284633765103275[52] = 0;
   out_6849284633765103275[53] = 0;
   out_6849284633765103275[54] = 0;
   out_6849284633765103275[55] = 0;
   out_6849284633765103275[56] = 0;
   out_6849284633765103275[57] = 0;
   out_6849284633765103275[58] = 0;
   out_6849284633765103275[59] = 0;
   out_6849284633765103275[60] = 0;
   out_6849284633765103275[61] = 0;
   out_6849284633765103275[62] = 1;
   out_6849284633765103275[63] = 0;
   out_6849284633765103275[64] = 0;
   out_6849284633765103275[65] = 0;
}
#include <eigen3/Eigen/Dense>
#include <iostream>

typedef Eigen::Matrix<double, DIM, DIM, Eigen::RowMajor> DDM;
typedef Eigen::Matrix<double, EDIM, EDIM, Eigen::RowMajor> EEM;
typedef Eigen::Matrix<double, DIM, EDIM, Eigen::RowMajor> DEM;

void predict(double *in_x, double *in_P, double *in_Q, double dt) {
  typedef Eigen::Matrix<double, MEDIM, MEDIM, Eigen::RowMajor> RRM;

  double nx[DIM] = {0};
  double in_F[EDIM*EDIM] = {0};

  // functions from sympy
  f_fun(in_x, dt, nx);
  F_fun(in_x, dt, in_F);


  EEM F(in_F);
  EEM P(in_P);
  EEM Q(in_Q);

  RRM F_main = F.topLeftCorner(MEDIM, MEDIM);
  P.topLeftCorner(MEDIM, MEDIM) = (F_main * P.topLeftCorner(MEDIM, MEDIM)) * F_main.transpose();
  P.topRightCorner(MEDIM, EDIM - MEDIM) = F_main * P.topRightCorner(MEDIM, EDIM - MEDIM);
  P.bottomLeftCorner(EDIM - MEDIM, MEDIM) = P.bottomLeftCorner(EDIM - MEDIM, MEDIM) * F_main.transpose();

  P = P + dt*Q;

  // copy out state
  memcpy(in_x, nx, DIM * sizeof(double));
  memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double));
}

// note: extra_args dim only correct when null space projecting
// otherwise 1
template <int ZDIM, int EADIM, bool MAHA_TEST>
void update(double *in_x, double *in_P, Hfun h_fun, Hfun H_fun, Hfun Hea_fun, double *in_z, double *in_R, double *in_ea, double MAHA_THRESHOLD) {
  typedef Eigen::Matrix<double, ZDIM, ZDIM, Eigen::RowMajor> ZZM;
  typedef Eigen::Matrix<double, ZDIM, DIM, Eigen::RowMajor> ZDM;
  typedef Eigen::Matrix<double, Eigen::Dynamic, EDIM, Eigen::RowMajor> XEM;
  //typedef Eigen::Matrix<double, EDIM, ZDIM, Eigen::RowMajor> EZM;
  typedef Eigen::Matrix<double, Eigen::Dynamic, 1> X1M;
  typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> XXM;

  double in_hx[ZDIM] = {0};
  double in_H[ZDIM * DIM] = {0};
  double in_H_mod[EDIM * DIM] = {0};
  double delta_x[EDIM] = {0};
  double x_new[DIM] = {0};


  // state x, P
  Eigen::Matrix<double, ZDIM, 1> z(in_z);
  EEM P(in_P);
  ZZM pre_R(in_R);

  // functions from sympy
  h_fun(in_x, in_ea, in_hx);
  H_fun(in_x, in_ea, in_H);
  ZDM pre_H(in_H);

  // get y (y = z - hx)
  Eigen::Matrix<double, ZDIM, 1> pre_y(in_hx); pre_y = z - pre_y;
  X1M y; XXM H; XXM R;
  if (Hea_fun){
    typedef Eigen::Matrix<double, ZDIM, EADIM, Eigen::RowMajor> ZAM;
    double in_Hea[ZDIM * EADIM] = {0};
    Hea_fun(in_x, in_ea, in_Hea);
    ZAM Hea(in_Hea);
    XXM A = Hea.transpose().fullPivLu().kernel();


    y = A.transpose() * pre_y;
    H = A.transpose() * pre_H;
    R = A.transpose() * pre_R * A;
  } else {
    y = pre_y;
    H = pre_H;
    R = pre_R;
  }
  // get modified H
  H_mod_fun(in_x, in_H_mod);
  DEM H_mod(in_H_mod);
  XEM H_err = H * H_mod;

  // Do mahalobis distance test
  if (MAHA_TEST){
    XXM a = (H_err * P * H_err.transpose() + R).inverse();
    double maha_dist = y.transpose() * a * y;
    if (maha_dist > MAHA_THRESHOLD){
      R = 1.0e16 * R;
    }
  }

  // Outlier resilient weighting
  double weight = 1;//(1.5)/(1 + y.squaredNorm()/R.sum());

  // kalman gains and I_KH
  XXM S = ((H_err * P) * H_err.transpose()) + R/weight;
  XEM KT = S.fullPivLu().solve(H_err * P.transpose());
  //EZM K = KT.transpose(); TODO: WHY DOES THIS NOT COMPILE?
  //EZM K = S.fullPivLu().solve(H_err * P.transpose()).transpose();
  //std::cout << "Here is the matrix rot:\n" << K << std::endl;
  EEM I_KH = Eigen::Matrix<double, EDIM, EDIM>::Identity() - (KT.transpose() * H_err);

  // update state by injecting dx
  Eigen::Matrix<double, EDIM, 1> dx(delta_x);
  dx  = (KT.transpose() * y);
  memcpy(delta_x, dx.data(), EDIM * sizeof(double));
  err_fun(in_x, delta_x, x_new);
  Eigen::Matrix<double, DIM, 1> x(x_new);

  // update cov
  P = ((I_KH * P) * I_KH.transpose()) + ((KT.transpose() * R) * KT);

  // copy out state
  memcpy(in_x, x.data(), DIM * sizeof(double));
  memcpy(in_P, P.data(), EDIM * EDIM * sizeof(double));
  memcpy(in_z, y.data(), y.rows() * sizeof(double));
}




}
extern "C" {

void live_update_4(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_4, H_4, NULL, in_z, in_R, in_ea, MAHA_THRESH_4);
}
void live_update_9(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_9, H_9, NULL, in_z, in_R, in_ea, MAHA_THRESH_9);
}
void live_update_10(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_10, H_10, NULL, in_z, in_R, in_ea, MAHA_THRESH_10);
}
void live_update_12(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_12, H_12, NULL, in_z, in_R, in_ea, MAHA_THRESH_12);
}
void live_update_35(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_35, H_35, NULL, in_z, in_R, in_ea, MAHA_THRESH_35);
}
void live_update_32(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<4, 3, 0>(in_x, in_P, h_32, H_32, NULL, in_z, in_R, in_ea, MAHA_THRESH_32);
}
void live_update_13(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_13, H_13, NULL, in_z, in_R, in_ea, MAHA_THRESH_13);
}
void live_update_14(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_14, H_14, NULL, in_z, in_R, in_ea, MAHA_THRESH_14);
}
void live_update_33(double *in_x, double *in_P, double *in_z, double *in_R, double *in_ea) {
  update<3, 3, 0>(in_x, in_P, h_33, H_33, NULL, in_z, in_R, in_ea, MAHA_THRESH_33);
}
void live_H(double *in_vec, double *out_925951862747328981) {
  H(in_vec, out_925951862747328981);
}
void live_err_fun(double *nom_x, double *delta_x, double *out_2728202755002846775) {
  err_fun(nom_x, delta_x, out_2728202755002846775);
}
void live_inv_err_fun(double *nom_x, double *true_x, double *out_6450214050690645905) {
  inv_err_fun(nom_x, true_x, out_6450214050690645905);
}
void live_H_mod_fun(double *state, double *out_2701558932546138787) {
  H_mod_fun(state, out_2701558932546138787);
}
void live_f_fun(double *state, double dt, double *out_3606051112273642094) {
  f_fun(state,  dt, out_3606051112273642094);
}
void live_F_fun(double *state, double dt, double *out_2182973698110817430) {
  F_fun(state,  dt, out_2182973698110817430);
}
void live_h_4(double *state, double *unused, double *out_8463469987022356377) {
  h_4(state, unused, out_8463469987022356377);
}
void live_H_4(double *state, double *unused, double *out_5080240377932983361) {
  H_4(state, unused, out_5080240377932983361);
}
void live_h_9(double *state, double *unused, double *out_2786992525549697552) {
  h_9(state, unused, out_2786992525549697552);
}
void live_H_9(double *state, double *unused, double *out_5321430024562574006) {
  H_9(state, unused, out_5321430024562574006);
}
void live_h_10(double *state, double *unused, double *out_8379412946135224056) {
  h_10(state, unused, out_8379412946135224056);
}
void live_H_10(double *state, double *unused, double *out_6888199329645064621) {
  H_10(state, unused, out_6888199329645064621);
}
void live_h_12(double *state, double *unused, double *out_5262287356934284136) {
  h_12(state, unused, out_5262287356934284136);
}
void live_H_12(double *state, double *unused, double *out_8347047287744606460) {
  H_12(state, unused, out_8347047287744606460);
}
void live_h_35(double *state, double *unused, double *out_4834460567699992938) {
  h_35(state, unused, out_4834460567699992938);
}
void live_H_35(double *state, double *unused, double *out_8446902435305590737) {
  H_35(state, unused, out_8446902435305590737);
}
void live_h_32(double *state, double *unused, double *out_1718054444930970599) {
  h_32(state, unused, out_1718054444930970599);
}
void live_H_32(double *state, double *unused, double *out_6802062925594691135) {
  H_32(state, unused, out_6802062925594691135);
}
void live_h_13(double *state, double *unused, double *out_2804481356306676794) {
  h_13(state, unused, out_2804481356306676794);
}
void live_H_13(double *state, double *unused, double *out_6190083131893926822) {
  H_13(state, unused, out_6190083131893926822);
}
void live_h_14(double *state, double *unused, double *out_2786992525549697552) {
  h_14(state, unused, out_2786992525549697552);
}
void live_H_14(double *state, double *unused, double *out_5321430024562574006) {
  H_14(state, unused, out_5321430024562574006);
}
void live_h_33(double *state, double *unused, double *out_2458995549900816337) {
  h_33(state, unused, out_2458995549900816337);
}
void live_H_33(double *state, double *unused, double *out_6849284633765103275) {
  H_33(state, unused, out_6849284633765103275);
}
void live_predict(double *in_x, double *in_P, double *in_Q, double dt) {
  predict(in_x, in_P, in_Q, dt);
}
}

const EKF live = {
  .name = "live",
  .kinds = { 4, 9, 10, 12, 35, 32, 13, 14, 33 },
  .feature_kinds = {  },
  .f_fun = live_f_fun,
  .F_fun = live_F_fun,
  .err_fun = live_err_fun,
  .inv_err_fun = live_inv_err_fun,
  .H_mod_fun = live_H_mod_fun,
  .predict = live_predict,
  .hs = {
    { 4, live_h_4 },
    { 9, live_h_9 },
    { 10, live_h_10 },
    { 12, live_h_12 },
    { 35, live_h_35 },
    { 32, live_h_32 },
    { 13, live_h_13 },
    { 14, live_h_14 },
    { 33, live_h_33 },
  },
  .Hs = {
    { 4, live_H_4 },
    { 9, live_H_9 },
    { 10, live_H_10 },
    { 12, live_H_12 },
    { 35, live_H_35 },
    { 32, live_H_32 },
    { 13, live_H_13 },
    { 14, live_H_14 },
    { 33, live_H_33 },
  },
  .updates = {
    { 4, live_update_4 },
    { 9, live_update_9 },
    { 10, live_update_10 },
    { 12, live_update_12 },
    { 35, live_update_35 },
    { 32, live_update_32 },
    { 13, live_update_13 },
    { 14, live_update_14 },
    { 33, live_update_33 },
  },
  .Hes = {
  },
  .sets = {
  },
  .extra_routines = {
    { "H", live_H },
  },
};

ekf_lib_init(live)
